package com.fimmlps.reronge.dto;

import com.fimmlps.reronge.entity.EntryTrigger;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class EntryTriggerDto {
    private long entryTriggerId;
    private long entrySingleId;
    private String text;

    public EntryTriggerDto(EntryTrigger trigger){
        this.entryTriggerId = trigger.getEntryTriggerId();
        this.entrySingleId =  trigger.getEntrySingleId();
        this.text = trigger.getText();
    }

    public static List<EntryTriggerDto> toDtoList(List<EntryTrigger> list){
        ArrayList<EntryTriggerDto> dtoList = new ArrayList<>();
        for(EntryTrigger trigger:list){
            dtoList.add(new EntryTriggerDto(trigger));
        }
        return dtoList;
    }
}
